﻿using Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IService
{
  public interface ISalesOrderService
    {
        //销售订单绑卡客户下拉框
        Task<List<CustomerSelectDto>> GetCustomerSelectList();

        //根据客户id查询联系人和联系电话
        Task<WMSBasicCustomer> GetCustomerDetailById(int customerId);

        //查询销售部门信息
        Task<List<OrganizationTreeDto>> GetOrganizationTreeAsync();



        // 按部门ID获取用户列表（转换为前端下拉框格式）
        Task<List<UserSelectDto>> GetUsersByDeptIdAsync(int deptId);

        // 按用户ID获取所属部门信息
        Task<DeptByUserDto> GetDeptByUserIdAsync(int userId);

        //初始化获取所有销售人信息
        Task<List<UserSelectDto>> GetAllPersonInChargeAsync();


        //销售订单新增销售部门展开的查询功能
        Task<List<OrganizationTreeDto>> GetOrganizationTreeAsync2(string keyword);






        //销售订单新增销售货品明细分页
        Task<PagedViewModel<ProductInformationEntity2>> GetAllProductInformationAsync(
string product_code = null,
string product_name = null,
string unit = null,
int currentPage = 1,
            int pageSize = 1);




        // 参数改为主表实体 + 明细列表
        Task<int> AddSalesOrderWithDetailsAsync(WMSOrderSalesOrder order, List<WMSOrderSalesOrderDetails> detailsList);



        //销售订单页面分页显示
        Task<PagedViewModel<WMSOrderSalesOrder2>> GetAllWMSOrderSalesOrder2Async(
string sales_order_no = null,
string document_status = null,
string customer_name = null,
 DateTime? sales_date = null,
 int currentPage = 1,
 int pageSize = 2);



        //根据销售单号查询销售订单详情

        Task<WMSOrderSalesOrder2> GetSalesOrderDetailByNo(string saleOrderNo);


        // 逻辑删除（批量），返回受影响的行数
        Task<int> LogicalDeleteBatch(List<string> saleOrderNos);
        // 逻辑删除（单条），返回受影响的行数
        Task<int> LogicalDeleteSingle(string saleOrderNo);




        /// <summary>
        /// 异步批量审核销售订单
        /// </summary>
        Task<int> BatchAuditAsync(List<int> orderIds, string auditResult, string auditOpinion, string reviewer);

        /// <summary>
        /// 异步批量撤销销售订单
        /// </summary>
        Task<int> BatchRevokeAsync(List<int> orderIds);

        /// <summary>
        /// 异步校验可审核的订单ID
        /// </summary>
        Task<List<int>> GetValidAuditOrderIdsAsync(List<int> orderIds);

        /// <summary>
        /// 异步校验可撤销的订单ID
        /// </summary>
        Task<List<int>> GetValidRevokeOrderIdsAsync(List<int> orderIds);




        /// <summary>
        /// 单条撤销方法
        /// </summary>
        /// <param name="saleOrderId"></param>
        /// <returns></returns>
        Task<int> LogicalRevokeSingle(int saleOrderId);




        //查询人员信息
        Task<IEnumerable<dynamic>> GetUsersByOrgIdAsync(int orgId, string keyword = "");


    }
}
